package CA;
import java.util.ArrayList;
import java.util.List;

import junit.framework.TestCase;


public class SequenceCheck_Test extends TestCase {

	private final String MainExaminLocation =System.getProperty("user.dir") + "/UnitTestData/SequenceCheck/";

	/*
	 * No use checking this now. It is in helper
	 
	public void testCreateMasterSequenceList(){

		List<IndividualFileContents> indFileList = new ArrayList<IndividualFileContents>();
		SequenceCheck sc = new SequenceCheck();
		Helper h = new Helper();
		indFileList = sc.createMasterSequenceList(CrashSuperLocation);
		
		// Just helps to ensure that everything is in order and that everything is set up properly
		assertEquals(4,h.getFileList(CrashSuperLocation+"filelist1/").size());
		assertEquals(1,h.getFolderList(CrashSuperLocation).size());
		
		// test the size of createMasterSequenceList	
		assertEquals(4,indFileList.size());
		assertEquals("xul.dll",indFileList.get(0).getValues()[0]);
		assertEquals("netwerk/base/src/nsSocketTransport2.cpp:352",indFileList.get(0).getValues()[2]);
		assertEquals("xul.dll",indFileList.get(1).getValues()[0]);
		
		// test the number of lines in each file
		assertEquals(17,indFileList.get(1).getValues().length);
		
	}
	
	*/
	
	
	
	
	
//	createSSM_MissingData
	
	public void testCreateSSM_MissingData()
	{
		List<SSM_MissingData> missingSSMDataList = new ArrayList<SSM_MissingData>();
		SequenceCheck sc = new SequenceCheck();
		Helper h = new Helper();
		missingSSMDataList = sc.createSSM_MissingData(sc.createMasterSequenceList(MainExaminLocation));
		
		// Make sure the correct number of missing items are found
		assertEquals(6,missingSSMDataList.size());
	
		assertEquals("",missingSSMDataList.get(0).getNextLineInfo());
		assertEquals("xul.dll^*^nsHttpTransaction::WritePipeSegment^*^netwerk/protocol/http/nsHttpTransaction.cpp:533",missingSSMDataList.get(0).getPreviousInfo());
		assertEquals("^*^@0x7fff^*^",missingSSMDataList.get(0).getErrorLineInfo());
		
		
		assertEquals("xul.dll^*^nsHttpTransaction::WriteSegments^*^netwerk/protocol/http/nsHttpTransaction.cpp:563",missingSSMDataList.get(1).getNextLineInfo());
		assertEquals("xul.dll^*^nsHttpTransaction::WritePipeSegment^*^netwerk/protocol/http/nsHttpTransaction.cpp:533",missingSSMDataList.get(1).getPreviousInfo());
		assertEquals("^*^@0x7fff^*^",missingSSMDataList.get(1).getErrorLineInfo());
	
		assertEquals("xul.dll^*^nsSocketInputStream::Read^*^netwerk/base/src/nsSocketTransport2.cpp:352",missingSSMDataList.get(2).getNextLineInfo());
		assertEquals("",missingSSMDataList.get(2).getPreviousInfo());
		assertEquals("^*^@0x7fff^*^",missingSSMDataList.get(2).getErrorLineInfo());
		
		assertEquals("foo1^*^blah4^*^fake4",missingSSMDataList.get(3).getNextLineInfo());
		assertEquals("aslfjslfj^*^blah3^*^fake3",missingSSMDataList.get(3).getPreviousInfo());
		assertEquals("^*^@0x7fff^*^",missingSSMDataList.get(3).getErrorLineInfo());
		
		assertEquals("^*^@0x7fff^*^",missingSSMDataList.get(4).getNextLineInfo());
		assertEquals("aslfjslfj^*^blah3^*^fake3",missingSSMDataList.get(4).getPreviousInfo());
		assertEquals("^*^@0x7fff^*^",missingSSMDataList.get(4).getErrorLineInfo());
	
		assertEquals("foo1^*^blah4^*^fake4",missingSSMDataList.get(5).getNextLineInfo());
		assertEquals("^*^@0x7fff^*^",missingSSMDataList.get(5).getPreviousInfo());
		assertEquals("^*^@0x7fff^*^",missingSSMDataList.get(5).getErrorLineInfo());
	
	//	int x = 4;
	//	System.out.println(missingSSMDataList.get(x).getFilePath());
	//	System.out.println(missingSSMDataList.get(x).getPreviousInfo());
	//	System.out.println(missingSSMDataList.get(x).getNextLineInfo());
	//	System.out.println(missingSSMDataList.get(x).getErrorLineInfo());
	
	
	}
	
	
	
}
